<%@ page language="java" pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib uri="/WEB-TAG/platForm.tld" prefix="PF"%>
<!--工程-->
<div class="easyui-layout" data-options="fit:true">
	<div class="TableTitle" data-options="region:'north',border:false">
		<c:if test="${pageset.pageType==1}">新增${JSP_Messager_Title}记录</c:if>
		<c:if test="${pageset.pageType==2}">修改${JSP_Messager_Title}记录</c:if>
		<c:if test="${pageset.pageType==0}">浏览${JSP_Messager_Title}记录</c:if>
	</div>
	<div data-options="region:'center'">
		<form id="dom_formfarmcodeproject">
			<input type="hidden" name="entity.id" value="${entity.id}">
			<table class="editTable">
				<tr>
					<td class="title">
						分类:
					</td>
					<td colspan="3">
						<c:if test="${pageset.pageType==1}">
							${type.name }
							<input name="entity.typeid" value="${type.id}" type="hidden">
						</c:if>
						<c:if test="${pageset.pageType==2}">
							<select id="entity_timeid" name="entity.typeid"
								class="easyui-combotree" style="width: 180px;"
								val="${type.name}"
								data-options="url:'admin/FarmCodeTypeLoadTreeNode.do?index=YEARS',
                      required:true,onlyLeaf:true,val:['${type.id}','${type.name}']">
							</select>
						</c:if>
					</td>
				</tr>
				<tr>
					<td class="title">
						名称:
					</td>
					<td colspan="3">
						<input type="text" style="width: 360px;"
							class="easyui-validatebox"
							data-options="required:true,validType:[,'maxLength[64]']"
							id="entity_name" name="entity.name" value="${entity.name}">

					</td>
				</tr>
				<tr>
					<td class="title">
						状态:
					</td>
					<td colspan="3">
						<select name="entity.pstate" id="entity_pstate"
							val="${entity.pstate}">
							<option value="1">
								可用
							</option>
							<option value="0">
								禁用
							</option>
						</select>
					</td>
				</tr>
				<tr>
					<td class="title">
						向导类型:
					</td>
					<td colspan="3">
						<select name="entity.type" id="entity_type" val="${entity.type}">
							<option value="1">
								操作功能向导
							</option>
							<option value="0">
								数据库表向导
							</option>
						</select>
					</td>
				</tr>
				<tr>
					<td class="title">
						备注:
					</td>
					<td colspan="3">
						<textarea rows="3" style="width: 360px;"
							class="easyui-validatebox"
							data-options="required:false,validType:[,'maxLength[256]']"
							id="entity_pcontent" name="entity.pcontent">${entity.pcontent}</textarea>
					</td>
				</tr>
				<tr>
					<td class="title">
						示意图:
					</td>
					<td colspan="3">
						<input type="text" style="width: 260px;"
							class="easyui-validatebox"
							data-options="validType:',maxLength[64]'"
							value="${entity.graphid}" id="file_name">
						<input type="button" id="uploadButton" value="上传示意图" />
						<input type="hidden" id="entity_fileid" name="entity.graphid"
							value="${entity.graphid}">
						<c:if test="${pageset.pageType!=0}">
							<script type="text/javascript">
	$(function() {
		var uploadbutton;
		uploadbutton = KindEditor.uploadbutton( {
			button : KindEditor('#uploadButton')[0],
			fieldName : 'imgFile',
			url : 'admin/FPImgupload.do',
			afterUpload : function(data) {
				if (data.error === 0) {
					$('#file_name').val(data.imgFileFileName);
					$("#entity_fileid").val(data.id);
				} else {
					if (data.message) {
						alert(data.message);
					} else {
						alert('请检查文件格式');
					}
				}
			},
			afterError : function(str) {
				alert('自定义错误信息: ' + str);
			}
		});
		uploadbutton.fileBox.change(function(e) {
			uploadbutton.submit();
		});

	});
</script>
						</c:if>
					</td>
				</tr>
				<c:if test="${entity.graphid!=null}">
					<tr>
						<td colspan="4">
							<img alt="" style="margin: 4px;"
								src="admin/FPloadfile.do?id=${entity.graphid}">
						</td>
					</tr>
				</c:if>
				<c:if test="${pageset.pageType==1}">
					<!--新增-->
				</c:if>
				<c:if test="${pageset.pageType==2}">
					<!--修改-->
				</c:if>
				<c:if test="${pageset.pageType==0}">
					<!--浏览-->
				</c:if>
			</table>
		</form>
	</div>
	<div data-options="region:'south',border:false">
		<div class="div_button" style="text-align: center; padding: 4px;">
			<c:if test="${pageset.pageType==1}">
				<a id="dom_add_entityfarmcodeproject" href="javascript:void(0)"
					iconCls="icon-save" class="easyui-linkbutton">增加</a>
			</c:if>
			<c:if test="${pageset.pageType==2}">
				<a id="dom_edit_entityfarmcodeproject" href="javascript:void(0)"
					iconCls="icon-save" class="easyui-linkbutton">修改</a>
			</c:if>
			<a id="dom_cancle_formfarmcodeproject" href="javascript:void(0)"
				iconCls="icon-cancel" class="easyui-linkbutton"
				style="color: #000000;">取消</a>
		</div>
	</div>
</div>
<script type="text/javascript">
	var submitAddActionfarmcodeproject = 'admin/FarmCodeProjectaddCommit.do';
	var submitEditActionfarmcodeproject = 'admin/FarmCodeProjecteditCommit.do';
	var currentPageTypefarmcodeproject = '${pageset.pageType}';
	var submitFormfarmcodeproject;
	$(function() {
		//表单组件对象
		submitFormfarmcodeproject = $('#dom_formfarmcodeproject').SubmitForm( {
			pageType : currentPageTypefarmcodeproject,
			grid : gridfarmcodeproject,
			currentWindowId : 'winfarmcodeproject'
		});
		//关闭窗口
		$('#dom_cancle_formfarmcodeproject').bind('click', function() {
			$('#winfarmcodeproject').window('close');
		});
		//提交新增数据
		$('#dom_add_entityfarmcodeproject').bind(
				'click',
				function() {
					submitFormfarmcodeproject
							.postSubmit(submitAddActionfarmcodeproject);
				});
		//提交修改数据
		$('#dom_edit_entityfarmcodeproject').bind(
				'click',
				function() {
					submitFormfarmcodeproject
							.postSubmit(submitEditActionfarmcodeproject);
				});
	});
	//-->
</script>